from selenium import  webdriver
import time
from selenium.webdriver.common.by import By


driver = webdriver.Chrome(r'D:\bianchengerbianchenger\driver\chromedriver.exe')
driver.get('https://www.ximalaya.com/')
driver.maximize_window()

driver.find_element(By.CLASS_NAME,'xui-header-iconNav-item._uH').click()

cls=driver.window_handles
driver.switch_to.window(cls[1])          #句柄为1  转到第二个网页

driver.find_element(By.CLASS_NAME,'login-tab-btn').click()

time.sleep(3)

driver.switch_to.window(cls[0])         #句柄为0   转回第一个网页进行操作

driver.find_element(By.CLASS_NAME,'xui-header-search-input').send_keys('凡人修仙传')   #输入凡人修仙传
driver.find_element(By.CLASS_NAME,'xui-header-search-button.xui-header-search-button_position').click()   #点击搜索按钮